import Qt 4.7

Component {
    Item {
        height: 140;
        width: parent.width
        clip: true

        Image {
            id: tweetbox
            source: "tweetbox.png"
        }

        Image {
            id: realImage;
            source: userImage
            anchors {
                left: parent.left
                leftMargin: 20
                top: parent.top
                topMargin: 20
                bottomMargin: 20
                rightMargin: 20
            }
            width:70; height:70
        }

        Text {
            id: tweetText
            anchors.top: realImage.top
            anchors.left: realImage.right
            anchors.bottom: realImage.bottom
            anchors.leftMargin: 20
            anchors.right: tweetbox.right
            anchors.rightMargin: 20
            font.pixelSize: 16
            clip: true
            width: 500
            wrapMode: Text.WordWrap
            textFormat: Text.RichText
            text: statusText 
            onLinkActivated: handleLink (link)
        }

        Text {
            anchors.top: tweetText.bottom
            anchors.left: tweetText.left
            anchors.bottom: tweetbox.bottom
            anchors.topMargin: 4
            font.pixelSize: 12
            clip: true
            width: tweetText.width
            wrapMode: Text.WordWrap
            textFormat: Text.RichText
            text: "<html><span style=\"color:#779dca\">"+timeStamp+" from "+source+"</span>"
        }

        function handleLink (link) {
            console.log("link: "+link)
            if (link.slice(0,4) == 'http') {
                Qt.openUrlExternally (link);
            }
        }
    }
}